<?php

/** Zend_Controller_Action */
require_once 'Zend/Controller/Action.php';

class ErrorController extends Zend_Controller_Action {
	public function errorAction() {
		$errors = $this->_getParam('error_handler');
		switch ($errors->type) {
			case Zend_Controller_Plugin_ErrorHandler :: EXCEPTION_NO_CONTROLLER :
			case Zend_Controller_Plugin_ErrorHandler :: EXCEPTION_NO_ACTION :
				// 404 error -- controller or action not found
				$this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
				$this->view->metaTitle = "HTTP/1.1 404 Not Found";
				$this->view->title = "Page Not Found!";
				$this->view->desc = "Sorry, we can't find the page you requested!";
				break;
			default :
				$exception = $errors->exception;
				$this->view->metaTitle = "Error Occured!";
				$this->view->title = "An exception has been raised!";
				$this->view->desc = $exception->getMessage()."<br/>".$exception->getTraceAsString();				
				break;
		}
	}
}